# 为了统计学生人数，可以给 Student 类增加一个类属性，每创建一个实例，该属性自动增加

# 定义学生类
class Student(object):
    # 定义类属性计数变量count
    count = 0

    # 类属性
    def __init__(self, name, score):
        self.__name = name
        self.__score = score
        # 实现计数
        Student.count += 1


xiaohong = Student("xiaohong", 60)
zhangsan = Student("zhangsan", 20)
zhangsan1 = Student("zhangsan1", 78)
zhangsan2 = Student("zhangsan2", 44)
# 访问并打印类属性
print(Student.count)


